package com.ply.entity.vo;

import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;

import java.util.List;

/**
 * @author XiaoPan
 * date: 2022/1/4 23:19
 * <p>
 * action: 状态码
 */

@Data
@AllArgsConstructor
@NoArgsConstructor
public class Result<T> {
    private String code;
    private String msg;
    private boolean isTrue;
    private T date;

    public Result(String code,String msg,boolean isTrue){
        this.code = code;
        this.msg = msg;
        this.isTrue = isTrue;
    }

    public static Result ok(){
        return new Result("0","成功",true);
    }
    public static Result ok(String msg){
        return new Result("0",msg,true);
    }

    public static <T> Result ok(String msg,T date){
        return new Result("0",msg,true, date);
    }
    public static <T> Result ok(T date){
        return new Result("0","成功",true, date);
    }



    public static Result fail(){
        return new Result("400","失败",false);
    }

    public static Result fail(String msg){
        return new Result("400",msg,false);
    }

}
